<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   主题：求助！R函数调试  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
   MathJax.Hub.Config({elements: ["bbpress-forums"]});
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://cos.name/cn/topic/2657/?new=1",
                  host: "http://cos.name",
                  prePath: "http://cos.name",
                  scheme: "http",
                  pathBase: "http://cos.name/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466447315: Accept with keywords: (title(0.333333333333):主题,函数,论坛, topn(0.1):RSS订阅,软件应用,小点,程序运行,帖子,R语言,作者,会员,内存,用户名,结果,主站,新鲜事,手册,库里,函数,电脑,机器运行,密码,总计,长时间,双核,例题,主题,普通,论坛,讨论区,机子,虚拟内存,原因).-->
 </head>
 <body class="topic bbpress single single-topic postid-2657 single-author sidebar" onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    主题：求助！R函数调试
   </h1>
  </div>
  <div class="container" id="xmain">
   <div class="hfeed site" id="page">
    <header class="site-header" id="masthead" role="banner">
     <div id="cos-logo">
      <a href="http://cos.name/cn">
       <img src="http://cos.name/cn/wp-content/themes/COS-forest/images/headers/cos-logo.png"/>
      </a>
     </div>
     <div class="navbar" id="navbar">
      <nav class="navigation main-navigation" id="site-navigation" role="navigation">
       <h3 class="menu-toggle">
        菜单
       </h3>
       <div class="menu-%e8%8f%9c%e5%8d%951-container">
        <ul class="nav-menu" id="menu-%e8%8f%9c%e5%8d%951">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-407772" id="menu-item-407772">
          <a href="http://cos.name/cn/">
           论坛首页
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407773" id="menu-item-407773">
          <a href="http://cos.name/cn/forums/">
           讨论区
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407774" id="menu-item-407774">
          <a href="http://cos.name/cn/wp-login.php?action=register">
           注册
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407819" id="menu-item-407819">
          <a href="http://cos.name/">
           主站
          </a>
         </li>
        </ul>
       </div>
      </nav>
      <!-- #site-navigation -->
     </div>
     <!-- #navbar -->
    </header>
    <!-- #masthead -->
    <div class="site-main" id="main">
     <div class="content-area" id="primary">
      <div class="site-content" id="content" role="main">
       <article class="post-2657 topic type-topic status-publish hentry" id="post-2657">
        <header class="entry-header">
         <h1 class="entry-title">
          求助！R函数调试
         </h1>
        </header>
        <!-- .entry-header -->
        <div class="entry-content">
         <div id="bbpress-forums">
          <div class="bbp-breadcrumb">
           <p>
            <a class="bbp-breadcrumb-home" href="http://cos.name/cn/">
             COS论坛 | 统计之都
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-root" href="http://cos.name/cn/forums/">
             讨论区
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/">
             软件应用
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/r-language/">
             S-Plus &amp; R语言
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <span class="bbp-breadcrumb-current">
             求助！R函数调试
            </span>
           </p>
          </div>
          <div class="bbp-template-notice info">
           <p class="bbp-topic-description">
            该主题包含 33 条回复，6个帖子，最后由
            <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3365/" rel="nofollow" title="查看fu_neng的档案">
             <img src="http://sdn.geekzu.org/avatar/1588aeac52314aec9f0d39a93b470639?s=14&amp;d=monsterid&amp;r=g"/>
            </a>
            <a class="bbp-author-name" href="http://cos.name/cn/profile/3365/" rel="nofollow" title="查看fu_neng的档案">
             fu_neng
            </a>
            在
            <a href="http://cos.name/cn/topic/2657/page/3/#post-218164" title="回复：求助！R函数调试">
             9 年, 5 月 之前
            </a>
            更新。
           </p>
          </div>
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 34 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/2657/page/2/?new=1">
             2
            </a>
            <a class="page-numbers" href="http://cos.name/cn/topic/2657/page/3/?new=1">
             3
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/2657/page/2/?new=1">
             →
            </a>
           </div>
          </div>
          <ul class="forums bbp-replies" id="topic-2657-replies">
           <li class="bbp-header">
            <div class="bbp-reply-author">
             作者
            </div>
            <!-- .bbp-reply-author -->
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-header -->
           <li class="bbp-body">
            <div class="bbp-reply-header" id="post-2657">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 上午6:01
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-2657">
               1 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-2657 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-1 user-id-3878 topic-author post-2657 topic type-topic status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               在学习PKG包HSAUR手册的第七章时，遇到个难题，机器运行了半个小时还不出结果，我把表达式及它的相关步骤复制到下面，望大家给予试试，最好能把每步应该注意的环节都注释出来，以供学习。
               <br/>
               ##################################################
               <br/>
               logL &lt;- function(param, x)
               <br/>
               {
               <br/>
               d1 &lt;- dnorm(x, mean = param[2], sd = param[3])
               <br/>
               d2 &lt;- dnorm(x, mean = param[4], sd = param[5])
               <br/>
               -sum(log(param[1] * d1 + (1 – param[1]) * d2))
               <br/>
               }
              </p>
              <p>
               startparam &lt;- c(p = 0.5, mu1 = 50, sd1 = 3, mu2 = 80,sd2 = 3)
               <br/>
               opp &lt;- optim(startparam, logL, x = faithful$waiting,
               <br/>
               method = "L-BFGS-B", lower = c(0.01, rep(1,4)),
               <br/>
               upper = c(0.99, rep(200, 4)))
              </p>
              <p>
               data("faithful", package = "datasets")
               <br/>
               x &lt;- faithful$waiting
              </p>
              <p>
               library("mclust")
               <br/>
               mc &lt;- Mclust(faithful$waiting)
              </p>
              <p>
               library("boot")
               <br/>
               fit &lt;- function(x, indx)
               <br/>
               {
               <br/>
               a &lt;- Mclust(x[indx], minG = 2, maxG = 2)$parameters
               <br/>
               if (a$pro[1] &lt; 0.5)
               <br/>
               return(c(p = a$pro[1], mu1 = a$mean[1],mu2 = a$mean[2]))
               <br/>
               return(c(p = 1 – a$pro[1], mu1 = a$mean[2],mu2 = a$mean[1]))
               <br/>
               }
              </p>
              <p>
               bootpara &lt;- boot(faithful$waiting, fit, R = 1000)  # 此步半天不给结果
               <br/>
               ###################################################
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213203">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午1:36
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213203">
               2 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213203 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-2 user-id-4299 post-213203 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               <img src="http://sdn.geekzu.org/avatar/173ad8f7ad1ede398f9a3fb979295547?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               huadeng
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               boot 函数是那个库里，我运行不能发现boot函数
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213204">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午1:41
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213204">
               3 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213204 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-3 user-id-3878 topic-author post-213204 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <blockquote class="d4pbbc-quote">
               <p>
                [b]引用第1楼[i]huadeng[/i]于[i]2006-11-24 21:36[/i]发表的“”[/b]:
                <br/>
                boot 函数是那个库里，我运行不能发现boot函数
               </p>
              </blockquote>
              <p>
               R的PKG中，“boot”，大约1M
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213205">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午1:49
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213205">
               4 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213205 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-4 user-id-3878 topic-author post-213205 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               boot(boot)
              </p>
              <p>
               Bootstrap Resampling
              </p>
              <p>
               Description
              </p>
              <p>
               Generate R bootstrap replicates of a statistic applied to data. Both parametric and nonparametric resampling are possible. For the nonparametric bootstrap, possible resampling methods are the ordinary bootstrap, the balanced bootstrap, antithetic resampling, and permutation. For nonparametric multi-sample problems stratified resampling is used. This is specified by including a vector of strata in the call to boot. Importance resampling weights may be specified.
              </p>
              <p>
               Usage
              </p>
              <p>
               boot(data, statistic, R, sim="ordinary", stype="i",
               <br/>
               strata=rep(1,n), L=NULL, m=0, weights=NULL,
               <br/>
               ran.gen=function(d, p) d, mle=NULL, …)
              </p>
              <p>
               Arguments
              </p>
              <p>
               data
               <br/>
               The data as a vector, matrix or data frame. If it is a matrix or data frame then each row is considered as one multivariate observation.
              </p>
              <p>
               statistic
               <br/>
               A function which when applied to data returns a vector containing the statistic(s) of interest. When sim="parametric", the first argument to statistic must be the data. For each replicate a simulated dataset returned by ran.gen will be passed. In all other cases statistic must take at least two arguments. The first argument passed will always be the original data. The second will be a vector of indices, frequencies or weights which define the bootstrap sample. Further, if predictions are required, then a third argument is required which would be a vector of the random indices used to generate the bootstrap predictions. Any further arguments can be passed to statistic through the …{} argument.
              </p>
              <p>
               R
               <br/>
               The number of bootstrap replicates. Usually this will be a single positive integer. For importance resampling, some resamples may use one set of weights and others use a different set of weights. In this case R would be a vector of integers where each component gives the number of resamples from each of the rows of weights.
              </p>
              <p>
               ……
              </p>
              <p>
               Details
              </p>
              <p>
               The statistic to be bootstrapped can be as simple or complicated as desired as long as its arguments correspond to the dataset and (for a nonparametric bootstrap) a vector of indices, frequencies or weights. statistic is treated as a black box by the boot function and is not checked to ensure that these conditions are met.
              </p>
              <p>
               The first order balanced bootstrap is described in Davison, Hinkley and Schechtman (1986). The antithetic bootstrap is described by Hall (1989) and is experimental, particularly when used with strata. The other non-parametric simulation types are the ordinary bootstrap (possibly with unequal probabilities), and permutation which returns random permutations of cases. All of these methods work independently within strata if that argument is supplied.
              </p>
              <p>
               For the parametric bootstrap it is necessary for the user to specify how the resampling is to be conducted. The best way of accomplishing this is to specify the function ran.gen which will return a simulated data set from the observed data set and a set of parameter estimates specified in mle.
              </p>
              <p>
               Value
              </p>
              <p>
               The returned value is an object of class "boot", containing the following components
              </p>
              <p>
               t0 The observed value of statistic applied to data.
               <br/>
               t A matrix with R rows each of which is a bootstrap replicate of statistic.
               <br/>
               R The value of R as passed to boot.
               <br/>
               data The data as passed to boot.
               <br/>
               seed The value of .Random.seed when boot was called.
               <br/>
               statistic The function statistic as passed to boot.
              </p>
              <p>
               Examples
               <br/>
               # usual bootstrap of the ratio of means using the city data
               <br/>
               ratio &lt;- function(d, w)
               <br/>
               sum(d$x * w)/sum(d$u * w)
               <br/>
               boot(city, ratio, R=999, stype="w")
              </p>
              <p>
               # Stratified resampling for the difference of means.  In this
               <br/>
               # example we will look at the difference of means between the final
               <br/>
               # two series in the gravity data.
               <br/>
               diff.means &lt;- function(d, f)
               <br/>
               {    n &lt;- nrow(d)
               <br/>
               gp1 &lt;- 1:table(as.numeric(d$series))[1]
               <br/>
               m1 &lt;- sum(d[gp1,1] * f[gp1])/sum(f[gp1])
               <br/>
               m2 &lt;- sum(d[-gp1,1] * f[-gp1])/sum(f[-gp1])
               <br/>
               ss1 &lt;- sum(d[gp1,1]^2 * f[gp1]) –
               <br/>
               (m1 *  m1 * sum(f[gp1]))
               <br/>
               ss2 &lt;- sum(d[-gp1,1]^2 * f[-gp1]) –
               <br/>
               (m2 *  m2 * sum(f[-gp1]))
               <br/>
               c(m1-m2, (ss1+ss2)/(sum(f)-2))
               <br/>
               }
               <br/>
               grav1 &lt;- gravity[as.numeric(gravity[,2])&gt;=7,]
               <br/>
               boot(grav1, diff.means, R=999, stype="f", strata=grav1[,2])
              </p>
              <p>
               #  In this example we show the use of boot in a prediction from
               <br/>
               #  regression based on the nuclear data.  This example is taken
               <br/>
               #  from Example 6.8 of Davison and Hinkley (1997).  Notice also
               <br/>
               #  that two extra arguments to statistic are passed through boot.
               <br/>
               nuke &lt;- nuclear[,c(1,2,5,7,8,10,11)]
               <br/>
               nuke.lm &lt;- glm(log(cost)~date+log(cap)+ne+ ct+log(cum.n)+pt, data=nuke)
               <br/>
               nuke.diag &lt;- glm.diag(nuke.lm)
               <br/>
               nuke.res &lt;- nuke.diag$res*nuke.diag$sd
               <br/>
               nuke.res &lt;- nuke.res-mean(nuke.res)
              </p>
              <p>
               #  We set up a new data frame with the data, the standardized
               <br/>
               #  residuals and the fitted values for use in the bootstrap.
               <br/>
               nuke.data &lt;- data.frame(nuke,resid=nuke.res,fit=fitted(nuke.lm))
              </p>
              <p>
               #  Now we want a prediction of plant number 32 but at date 73.00
               <br/>
               new.data &lt;- data.frame(cost=1, date=73.00, cap=886, ne=0,
               <br/>
               ct=0, cum.n=11, pt=1)
               <br/>
               new.fit &lt;- predict(nuke.lm, new.data)
              </p>
              <p>
               nuke.fun &lt;- function(dat, inds, i.pred, fit.pred, x.pred)
               <br/>
               {
               <br/>
               assign(".inds", inds, envir=.GlobalEnv)
               <br/>
               lm.b &lt;- glm(fit+resid[.inds] ~date+log(cap)+ne+ct+
               <br/>
               log(cum.n)+pt, data=dat)
               <br/>
               pred.b &lt;- predict(lm.b,x.pred)
               <br/>
               remove(".inds", envir=.GlobalEnv)
               <br/>
               c(coef(lm.b), pred.b-(fit.pred+dat$resid[i.pred]))
               <br/>
               }
              </p>
              <p>
               nuke.boot &lt;- boot(nuke.data, nuke.fun, R=999, m=1,
               <br/>
               fit.pred=new.fit, x.pred=new.data)
               <br/>
               #  The bootstrap prediction error would then be found by
               <br/>
               mean(nuke.boot$t[,8]^2)
               <br/>
               #  Basic bootstrap prediction limits would be
               <br/>
               new.fit-sort(nuke.boot$t[,8])[c(975,25)]
              </p>
              <p>
               #  Finally a parametric bootstrap.  For this example we shall look
               <br/>
               #  at the air-conditioning data.  In this example our aim is to test
               <br/>
               #  the hypothesis that the true value of the index is 1 (i.e. that
               <br/>
               #  the data come from an exponential distribution) against the
               <br/>
               #  alternative that the data come from a gamma distribution with
               <br/>
               #  index not equal to 1.
               <br/>
               air.fun &lt;- function(data)
               <br/>
               {    ybar &lt;- mean(data$hours)
               <br/>
               para &lt;- c(log(ybar),mean(log(data$hours)))
               <br/>
               ll &lt;- function(k) {
               <br/>
               if (k &lt;= 0) out &lt;- 1e200 # not NA
               <br/>
               else out &lt;- lgamma(k)-k*(log(k)-1-para[1]+para[2])
               <br/>
               out
               <br/>
               }
               <br/>
               khat &lt;- nlm(ll,ybar^2/var(data$hours))$estimate
               <br/>
               c(ybar, khat)
               <br/>
               }
              </p>
              <p>
               air.rg &lt;- function(data, mle)
               <br/>
               #  Function to generate random exponential variates.  mle will contain
               <br/>
               #  the mean of the original data
               <br/>
               {    out &lt;- data
               <br/>
               out$hours &lt;- rexp(nrow(out), 1/mle)
               <br/>
               out
               <br/>
               }
              </p>
              <p>
               air.boot &lt;- boot(aircondit, air.fun, R=999, sim="parametric",
               <br/>
               ran.gen=air.rg, mle=mean(aircondit$hours))
              </p>
              <p>
               # The bootstrap p-value can then be approximated by
               <br/>
               sum(abs(air.boot$t[,2]-1) &gt; abs(air.boot$t0[2]-1))/(1+air.boot$R)
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213206">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午1:53
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213206">
               5 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213206 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-5 user-id-4299 post-213206 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               <img src="http://sdn.geekzu.org/avatar/173ad8f7ad1ede398f9a3fb979295547?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               huadeng
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               嘿嘿，搞错了，我调试了一下。估计错在最后两步。由于我对bootstrap内容了解很少，故不能解释。不好意思了。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213208">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:02
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213208">
               6 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213208 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-6 user-id-3878 topic-author post-213208 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               帮助里的例题都运行正常，但这个手册中的题原因还没有找到
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213209">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:12
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213209">
               7 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213209 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-7 user-id-4299 post-213209 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               <img src="http://sdn.geekzu.org/avatar/173ad8f7ad1ede398f9a3fb979295547?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               huadeng
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               我去看看这手册
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213211">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:13
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213211">
               8 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213211 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-8 user-id-1 post-213211 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/1/" rel="nofollow" title="查看谢益辉的档案">
               <img src="http://sdn.geekzu.org/avatar/1022d8e6ebc94e8f6bca9a86cebe312a?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/1/" rel="nofollow" title="查看谢益辉的档案">
               谢益辉
              </a>
              <br/>
              <div class="bbp-author-role">
               站长
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               我没敢试1000次，只作了50次bootstrap就挺慢的了
              </p>
              <p>
               &gt; system.time(bootpara &lt;- boot(faithful$waiting, fit, R = 50))
               <br/>
               [1] 39.66  0.16 45.05    NA    NA
              </p>
              <p>
               我的电脑本身也只有256M内存。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213212">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:20
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213212">
               9 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213212 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-9 user-id-3878 topic-author post-213212 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               我的100次还调出来，一分钟吧，而1000次，好几次了，最长一次，45分钟没有结果
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213213">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:26
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213213">
               10 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213213 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-10 user-id-4299 post-213213 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               <img src="http://sdn.geekzu.org/avatar/173ad8f7ad1ede398f9a3fb979295547?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/4299/" rel="nofollow" title="查看huadeng的档案">
               huadeng
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               程序没问题，我做了100次，但很慢，我的电脑是双核，512 的，花了一分多钟。结果如下：
               <br/>
               &gt; bootpara &lt;- boot(faithful$waiting, fit, R = 100)
               <br/>
               &gt; bootpara
              </p>
              <p>
               ORDINARY NONPARAMETRIC BOOTSTRAP
              </p>
              <p>
               Call:
               <br/>
               boot(data = faithful$waiting, statistic = fit, R = 100)
              </p>
              <p>
               Bootstrap Statistics :
               <br/>
               original       bias    std. error
               <br/>
               t1*  0.3610159 -0.003395616  0.03105552
               <br/>
               t2* 54.6191115 -0.014340831  0.77774902
               <br/>
               t3* 80.0938427 -0.235098402  1.81724872
               <br/>
               &gt;
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213216">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:33
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213216">
               11 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213216 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-11 user-id-3878 topic-author post-213216 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               &gt; bootpara &lt;- boot(faithful$waiting, fit, R = 500)
               <br/>
               &gt; bootpara
              </p>
              <p>
               ORDINARY NONPARAMETRIC BOOTSTRAP
              </p>
              <p>
               Call:
               <br/>
               boot(data = faithful$waiting, statistic = fit, R = 500)
              </p>
              <p>
               Bootstrap Statistics :
               <br/>
               original       bias    std. error
               <br/>
               t1*  0.3610159 -0.007233957  0.03717666
               <br/>
               t2* 54.6191115 -0.115011885  0.92811284
               <br/>
               t3* 80.0938427 -0.411865915  2.66701469
               <br/>
               &gt;
               <br/>
               ## 抽500次，花了9分钟
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213217">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:36
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213217">
               12 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213217 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-12 user-id-3849 post-213217 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3849/" rel="nofollow" title="查看anning189的档案">
               <img src="http://sdn.geekzu.org/avatar/f8d6415705583cd10615d52a1b6797db?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3849/" rel="nofollow" title="查看anning189的档案">
               anning189
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               程序运行了长时间没有结束，还没细看什么原因
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213219">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:37
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213219">
               13 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213219 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-13 user-id-3878 topic-author post-213219 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               这该死的手册，弄那么大，以为操作错了
               <br/>
               谢谢楼上两位帮忙
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213222">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月24日 下午2:42
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213222">
               14 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213222 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-14 user-id-3878 topic-author post-213222 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               <img src="http://sdn.geekzu.org/avatar/b46e95d66e3bc69f588b9f002f09b1ce?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3878/" rel="nofollow" title="查看areg的档案">
               areg
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <blockquote class="d4pbbc-quote">
               <p>
                [b]引用第11楼[i]anning189[/i]于[i]2006-11-24 22:36[/i]发表的“”[/b]:
                <br/>
                程序运行了长时间没有结束，还没细看什么原因
               </p>
              </blockquote>
              <p>
               huadeng刚才回了个长途电话，说是这种抽样就是慢，那么在学习中，把原手册中的R改小点，由1000改成100次，应该多数人都能行。R=500次，我的机器P4, 1.7G；内存512，虚拟内存2G，花了快10分钟。
               <br/>
               谢谢大家支持
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-213602">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2006年11月28日 上午5:47
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/2657/#post-213602">
               15 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-213602 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-2657 bbp-reply-position-15 user-id-3849 post-213602 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/3849/" rel="nofollow" title="查看anning189的档案">
               <img src="http://sdn.geekzu.org/avatar/f8d6415705583cd10615d52a1b6797db?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/3849/" rel="nofollow" title="查看anning189的档案">
               anning189
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               咳，我的机子不太爽啊
               <br/>
               AMD2500+，256DDR，虚拟2G，配置低
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
           </li>
           <!-- .bbp-body -->
           <li class="bbp-footer">
            <div class="bbp-reply-author">
             作者
            </div>
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-footer -->
          </ul>
          <!-- #topic-2657-replies -->
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 34 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/2657/page/2/?new=1">
             2
            </a>
            <a class="page-numbers" href="http://cos.name/cn/topic/2657/page/3/?new=1">
             3
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/2657/page/2/?new=1">
             →
            </a>
           </div>
          </div>
          <div class="bbp-no-reply" id="no-reply-2657">
           <div class="bbp-template-notice">
            <p>
             您必须先登录才能回复该主题。
            </p>
           </div>
          </div>
         </div>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta">
        </footer>
        <!-- .entry-meta -->
       </article>
       <!-- #post -->
       <div class="comments-area" id="comments">
       </div>
       <!-- #comments -->
      </div>
      <!-- #content -->
     </div>
     <!-- #primary -->
     <div class="sidebar-container" id="tertiary" role="complementary">
      <div class="sidebar-inner">
       <div class="widget-area">
        <aside class="widget bbp_widget_login" id="bbp_login_widget-2">
         <h3 class="widget-title">
          登录
         </h3>
         <form action="http://cos.name/cn/wp-login.php" class="bbp-login-form" method="post">
          <fieldset>
           <legend>
            登录
           </legend>
           <div class="bbp-username">
            <label for="user_login">
             用户名:
            </label>
           </div>
           <div class="bbp-password">
            <label for="user_pass">
             密码:
            </label>
           </div>
           <div class="bbp-remember-me">
            <label for="rememberme">
             记住用户名
            </label>
           </div>
           <div class="bbp-submit-wrapper">
            <button class="button submit user-submit" id="user-submit" name="user-submit" tabindex="104" type="submit">
             登录
            </button>
           </div>
           <div class="bbp-login-links">
            <a class="bbp-register-link" href="http://cos.name/cn/wp-login.php?action=register" title="注册">
             注册
            </a>
            <a class="bbp-lostpass-link" href="http://cos.name/cn/wp-login.php?action=lostpassword" title="忘记密码">
             忘记密码
            </a>
           </div>
          </fieldset>
         </form>
        </aside>
        <aside class="widget widget_text" id="text-7">
         <h3 class="widget-title">
          搜索
         </h3>
         <div class="textwidget">
          <form action="http://www.google.com/search" id="bbp-search-form" method="get" onsubmit="Gsitesearch(this)" role="search">
           <div>
           </div>
          </form>
          <form id="bbp-search-form-baidu" onsubmit="g(this)" role="search">
           <div>
           </div>
          </form>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-2">
         <h3 class="widget-title">
          新鲜事
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <a href="http://cos.name/cn/topics/">
             最新帖子
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/popular/">
             最热门主题
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/no-replies/">
             消灭零回复
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-3">
         <h3 class="widget-title">
          RSS订阅
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/topics/feed/">
             所有主题
            </a>
           </li>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/forums/feed/">
             所有帖子
            </a>
           </li>
          </ul>
         </div>
        </aside>
       </div>
       <!-- .widget-area -->
      </div>
      <!-- .sidebar-inner -->
     </div>
     <!-- #tertiary -->
    </div>
    <!-- #main -->
    <footer class="site-footer" id="colophon" role="contentinfo">
     <div class="site-info">
      版权所有 © 2014 统计之都 | 由
      <a href="http://wordpress.org/">
       WordPress
      </a>
      构建 | 主题修改自
      <a href="http://wordpress.org/themes/twentythirteen">
       Twenty Thirteen
      </a>
     </div>
     <!-- .site-info -->
    </footer>
    <!-- #colophon -->
   </div>
   <!-- #page -->
  </div>
 </body>
</html>